const state = {
    userToken: "",
    userAlias: "",
    userID: 0,
}

const mutations = {
    SET_USER_TOKEN(state, token) {
        state.userToken = token;
    },
    SET_USER_ALIAS(state, alias) {
        state.userAlias = alias;
    },
    SET_USER_ID(state, id) {
        state.userID = id;
    },
    INIT_USER(state) {
        state.userToken = "";
        state.userAlias = "";
        state.userID = 0;
    }
}

const actions = {
    someAsyncTask({ commit }) {
        // do something async
        commit('SET_USER_TOKEN'),
        commit('SET_USER_ALIAS'),
        commit('SET_USER_ID'),
        commit('INIT_USER')
    }
}


export default {
    state,
    mutations,
    actions,
}